using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using AnimationPage.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace AnimationPage.ViewModels;

public partial class LoginPageViewModel : ViewModelBase
{
    [ObservableProperty] private string? _email;

    [RelayCommand]
    private void OnRegister()
    {
        App.GoPage(new RegisterPage
        {
            DataContext = new RegisterPageViewModel()
        });
    }

    [RelayCommand]
    private async Task OnLoginAsync()
    {
        await RunCommandAsync(() => IsBusy, async () =>
        {
            await Task.Delay(1000);

            App.GoPage(new ChatPage()
            {
                DataContext = new ChatPageViewModel()
            });
        });
    }
}